<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/static/js3/jQuery-2.1.4/jquery-2.1.4.min.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="/static/bootstrap/bootstrap-3.3.7-dist/css/bootstrap.css" rel="stylesheet">
    <script src="/static/bootstrap/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
    <script src="/static/bootstrap/plugins/twbsPagination/jquery.twbsPagination.min.js"></script>
<html>
<head>
    <title>Title</title>
</head>
<body>
<script type="text/javascript">
    function go(pageNo){
        document.getElementById("currentPage").value=pageNo
        document.forms[0].submit();
    }
</script>
<script>
    $(function () {
        $('#pagination-demo').twbsPagination{
            totalPages:${result.totalPage} ,
            startPage:${result.currentPage},
            visiblePages:5,
                first:'首页',
                prev:'上一页',
                next:'下一页',
                last:'尾页',
                onPageClick:function (enent,page) {
                $('#currentPage').val(page);
                $('#serachForm').submit();
            }
        }
    })
</script>
<div class="container">
<a href="/department/input.do" class="btn btn-primary"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增</a>
<form action="/department/list.do" method="post">
    名称<input name="name" value="${qo.name}">
    <%--名称<input name="name" value="${qo.name}">
    名称<input name="name" value="${qo.name}">--%>
    <input type="button" onclick="go(1)" value="查询"><br/>
<table class="table table-bordered table-hover">
    <tr>
        <th>编号</th>
        <th>名称</th>
        <th>编号</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${result.list}" var="dept" varStatus="vs">
        <tr>
            <th>${vs.count}</th>
            <th>${dept.name}</th>
            <th>${dept.sn}</th>
            <th>
                <a href="/department/delete.do?id=${dept.id}" class="btn bg-danger">
                    <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>删除</a>
                <a href="/department/input.do?id=${dept.id}" class="btn bg-primary">
                    <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>编辑</a>
            </th>
        </tr>

    </c:forEach>
    <tr>
        <td colspan="4">
            <a href="javascript:go(1)">首页</a>
            <a href="javascript:go(${result.prevPage})">上一页</a>
            <a href="javascript:go(${result.nextPage})">下一页</a>
            <a href="javascript:go(${result.totalPage})">尾页</a>
            当前第${result.currentPage} / ${result.totalPage}页 共 ${result.totalCount} 条数据
            跳转到:<input type="number" min="1" max="${result.totalPage}"
                       name="currentPage" id="currentPage" value="${result.currentPage}">页<input type="submit" value="GO">

            每页显示<select name="pageSize" onchange="go(1)">
            <option ${qo.pageSize==5?'selected':''}>5</option>
            <option ${qo.pageSize==10?'selected':''}>10</option>
            <option ${qo.pageSize==15?'selected':''}>15</option>
        </select>
        </td>
    </tr>
</table>
</form>
    <div style="text-align: center">
        <ul id="pagination-demo" class="pagination"></ul>
    </div>
</div>
</body>
</html>
